import axiosIns from '../../utils/request'

export default {
  login (loginObj) {
    return axiosIns.post('/login', loginObj)
  },

  getUserList (params) {
    return axiosIns.get('/users', { params: params })
  },

  chagneUserState (uId, type) {
    return axiosIns.put(`users/${uId}/state/${type}`)
  },

  addUser (options) {
    return axiosIns.post('users', options)
  },

  getUserById (id) {
    return axiosIns.get(`users/${id}`)
  },

  updateUserById (id, data) {
    return axiosIns.put(`users/${id}`, data)
  },

  deletUserById (id) {
    return axiosIns.delete(`users/${id}`)
  },

  getUserRoleList () {
    return axiosIns.get('roles')
  },

  assignUserRole (id, data) {
    return axiosIns.put(`users/${id}/role`, data)
  }
}
